
// 导入模型
const Course = require( '../models/Course' );
const Student = require( '../models/Student' );
const Score = require( '../models/Score' );

// 通过导入 association 让其中代码执行，从而维护好关联关系
require('../models/association.js');

Course.findAll({
    include: {
        model: Student,
        as: 'students'
    }
}).then( courseInstances => {
    courseInstances.forEach( course => {
        console.log( course instanceof Course );
        console.log( course.toJSON() );
    });
});